#pragma once

#include "BasicView.h"
#include "Tool.h"
#include <memory>

class Workbench	: public BasicView
{
public:
	Workbench();           // protected constructor used by dynamic creation
	virtual ~Workbench();

// Attributes
private:
	Tool *						m_pTool;
	bool						m_Inside;
	std::auto_ptr<Manipulator>	m_pManip;
// Temporary:
	Tool *						m_pActiveTool;
	Tool *						m_pAltTool;
public:
	virtual Tool * GetTool() const;
	Manipulator * GetManipulator() const
		{ return m_pManip.get(); }
	bool IsInside() const
		{ return m_Inside; }

	virtual Tool * GetActiveTool() const
		{ return m_pActiveTool; }
	virtual Tool * GetAltTool() const
		{ return m_pAltTool; }
// Operations
public:
	void SetActiveTool(Tool * pTool);
	void SetAltTool(Tool * pTool);
	void SetManipulator(std::auto_ptr<Manipulator>);
	void UpdateCursor();
protected:
	Tool * GetCurrentTool() const;

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(Workbench)
public:
	virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
protected:
	virtual void OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView);
	//}}AFX_VIRTUAL

protected:
	virtual void HandleActiveToolChange() { }
	virtual void HandleAltToolChange() { }
	virtual void HandleKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	virtual void HandleKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
	virtual void HandleSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	virtual void HandleSysKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
	virtual void HandleLButtonDblClk(UINT nFlags, CPoint point);
	virtual void HandleLButtonDown(UINT nFlags, CPoint point);
	virtual void HandleLButtonUp(UINT nFlags, CPoint point);
	virtual void HandleMouseMove(UINT nFlags, CPoint point);
	virtual void HandleMouseLeave();
	virtual void HandleRButtonDblClk(UINT nFlags, CPoint point);
	virtual void HandleRButtonDown(UINT nFlags, CPoint point);
	virtual void HandleRButtonUp(UINT nFlags, CPoint point);
	virtual BOOL HandleSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
	virtual void HandleSetFocus(CWnd* pOldWnd);
	virtual void HandleKillFocus(CWnd* pNewWnd);
	virtual void HandleSize(UINT nType, int cx, int cy);
};


//{{AFX_INSERT_LOCATION}}
